package com.example.day05.homework;

import java.util.Date;

public class SalesEmployee  extends  Employee{

    private  double count ;
    private  double  probability;

    public SalesEmployee(String name, Date birthday, double count, double probability) {
        super(name, birthday);
        this.count = count;
        this.probability = probability;
    }

    public double getCount() {
        return count;
    }

    public void setCount(double count) {
        this.count = count;
    }

    public double getProbability() {
        return probability;
    }

    public void setProbability(double probability) {
        this.probability = probability;
    }

    @Override
    public double getSalary(int month) {

        if(this.getBirthday().getMonth()==month){
            this.setCount( (this.getCount()+this.getCount()*this.getProbability())+100);
        }else{
            this.setCount( (this.getCount()+this.getCount()*this.getProbability()));
        }
        return this.getCount();
    }

    @Override
    public String toString() {

        final StringBuilder sb = new StringBuilder("SalesEmployee{");
        super.toString();
        sb.append("count=").append(count);
        sb.append(", probability=").append(probability);
        sb.append('}');
        return sb.toString();
    }
}
